/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.camelspit.preludetoarmageddon.entity;
import java.util.Arrays;
/**
 *-TODO - Add toString() and fromString()
 *      - Add operator[] overload
 *      - Add show() to display stats on the window.
 * @author DMK
 */
public class EntityAttributes {
    private int[] baseStats;
    private int[] stats;


    public EntityAttributes() {
        baseStats = new int[Attributes.length];
        stats = new int[Attributes.length];
    }

    public EntityAttributes(int[] baseStats) {
        this.baseStats = baseStats;
    }

    private int[] getStats() {return this.stats;}


    public int getAttribute(Attributes attr) {
        return stats[attr.getValue()];
    }

    public void setAttribute(Attributes attr, int setAttr) {
        if(setAttr >= 0) {
            stats[attr.getValue()] = setAttr;
        }
    }

    public void addToAttribute(Attributes attr, int add) {
        stats[attr.getValue()] += add;
    }

    public int getBaseStat(Attributes attr) {
        return baseStats[attr.getValue()];
    }

    public void setBaseStat(Attributes stat, int val) {
        baseStats[stat.getValue()] = val;
    }

    public void addToBaseAttr(Attributes attr, int val) {
        baseStats[attr.getValue()] += val;
    }
}
